package com.permission.model;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.solution.framework.model.BaseBean;

import javax.persistence.*;

/**
 * Created with generator tools.
 * User: sunguangzhu
 * DateTime:2014-05-07 01:19:05
 */
@Entity
@Table(name = "t_per_role")
public class PerRole extends BaseBean implements java.io.Serializable {

    /**
     * 名称
     */
    private java.lang.String name;

    /**
     * 用户角色集合
     */
    private java.util.Set<com.permission.model.PerUserRole> perUserRoles;

    /**
     * 角色资源集合
     */
    private java.util.Set<com.permission.model.PerRoleResource> perRoleResources;

    /**
     * default constructor
     */
    public PerRole() {
    }

    /**
     * full constructor
     *
     * @param name
     * @param perUserRoles
     * @param perRoleResources
     */
    public PerRole(java.lang.String name, java.util.Set<com.permission.model.PerUserRole> perUserRoles, java.util.Set<com.permission.model.PerRoleResource> perRoleResources) {
        this.name = name;
        this.perUserRoles = perUserRoles;
        this.perRoleResources = perRoleResources;
    }

    /**
     * getter
     */
    @Column
    public java.lang.String getName() {
        return this.name;
    }

    /**
     * setter
     *
     * @param name
     */
    public void setName(java.lang.String name) {
        this.name = name;
    }

    /**
     * getter
     */
    @JsonBackReference
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "perRole")
    public java.util.Set<com.permission.model.PerUserRole> getPerUserRoles() {
        return this.perUserRoles;
    }

    /**
     * setter
     *
     * @param perUserRoles
     */
    public void setPerUserRoles(java.util.Set<com.permission.model.PerUserRole> perUserRoles) {
        this.perUserRoles = perUserRoles;
    }

    /**
     * getter
     */
    @JsonBackReference
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "perRole")
    public java.util.Set<com.permission.model.PerRoleResource> getPerRoleResources() {
        return this.perRoleResources;
    }

    /**
     * setter
     *
     * @param perRoleResources
     */
    public void setPerRoleResources(java.util.Set<com.permission.model.PerRoleResource> perRoleResources) {
        this.perRoleResources = perRoleResources;
    }

}
